﻿using Nuwanda.Common;
using StructureMap;

namespace Nuwanda.TfsSpotlight.Shell.Services.Interfaces
{
    /// <summary>Facilitates asynchronous operations</summary>
    [Author("Bartłomiej Legiędź")]
    [PluginFamily("Worker")]
    public interface IWorker
    {
        /// <summary>Checks whether the worker is working</summary>
        bool IsWorking { get; }

        /// <summary>Starts worker</summary>
        /// <returns>True if succeeded</returns>
        bool BeginWork();

        /// <summary>Waits until the worker stops working and starts new work</summary>
        void WaitAndBeginWork();

        /// <summary>Ends current work</summary>
        void EndWork();

        /// <summary>Waits till the end of current work</summary>
        void WaitTillEnd();
    }
}